]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
modalDialog: Destroy dialogs on close
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 4 Apr 2013 18:47:38 +0000 (14:47 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 4 Apr 2013 19:04:14 +0000 (15:04 -0400)
It turns out that we never destroyed modal dialogs when closing
them, causing them to still linger in the scene graph even when
there were no references to them in the JS. The one case where
we don't want to destroy modal dialogs after being closed is
endSessionDialog, so provide a parameter that allows classes
to override this behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=697295

js/ui/endSessionDialog.js
js/ui/modalDialog.js

index b7850a484aecb0e8a51bab04d03619405ed1188e..d3225819aee0dc171693e7090ecab90e1493a3e2 100644 (file)
@@ -225,7 +225,8 @@ const EndSessionDialog = new Lang.Class({
     Extends: ModalDialog.ModalDialog,
 
     _init: function() {
-        this.parent({ styleClass: 'end-session-dialog' });
+        this.parent({ styleClass: 'end-session-dialog',
+                      destroyOnClose: false });
 
         this._user = AccountsService.UserManager.get_default().get_user(GLib.get_user_name());
 
index 304733efb1847a04e2274f73c887ff811fb97c21..beac7fe09b845c7a17d3600bd494e6bbc7f63be0 100644 (file)
@@ -38,13 +38,15 @@ const ModalDialog = new Lang.Class({
                                         styleClass: null,
                                         parentActor: Main.uiGroup,
                                         keybindingMode: Shell.KeyBindingMode.SYSTEM_MODAL,
-                                        shouldFadeIn: true });
+                                        shouldFadeIn: true,
+                                        destroyOnClose: true });
 
         this.state = State.CLOSED;
         this._hasModal = false;
         this._keybindingMode = params.keybindingMode;
         this._shellReactive = params.shellReactive;
         this._shouldFadeIn = params.shouldFadeIn;
+        this._destroyOnClose = params.destroyOnClose;
 
         this._group = new St.Widget({ visible: false,
                                       x: 0,
@@ -277,6 +279,9 @@ const ModalDialog = new Lang.Class({
                                    this.state = State.CLOSED;
                                    this._group.hide();
                                    this.emit('closed');
+
+                                   if (this._destroyOnClose)
+                                       this.destroy();
                                })
                          });
     },